const app = getApp()
import api from '../../utils/api'

Page({
  data: {
    monery: '',
    user:{}
  },
  onShow: function () {
    this.getUser();
  },
  setMonery:function(e) {
    let monery = e.currentTarget.dataset.monery;
    this.setData({ monery});
  },
  onSubmit:function(e){
    wx.showModal({
      title: '提示',
      content: '确定提交支付吗？',
      success: function (sm) {
        if (sm.confirm) {
          wx.showToast({
            title: '请选择数据!',
            icon: 'none',
            duration: 1000,
          })
        }
      }
    })
  },
  getInputValue(e) {
    let value = this.validateNumber(e.detail.value)
    this.setData({ monery: value });
  },
  validateNumber(val) {
    return val.replace(/\D/g, '')
  },
  getUser() {
    let user = wx.getStorageSync("user");
    if (!user.bh) {
      wx.redirectTo({
        url: '../login/login',
      })
    }else{
      this.setData({
        user: user
      })
    }
  }
})